<script >
	function addElement() {

	  var ni = document.getElementById('myDiv');

	  var numi = document.getElementById('theValue');

	  var num = (document.getElementById('theValue').value -1)+ 2;

	  numi.value = num;

	  var newdiv = document.createElement('div');

	  var divIdName = 'my'+num+'Div';

	  newdiv.setAttribute('id',divIdName);
	  newdiv.setAttribute('style','float:left; width:100%');

	  newdiv.innerHTML = '<p><input type="hidden" id="userfile'+num+'" name="sanpham_hinhanh'+num+'" value=""/><img src="" width="50" id="imgdef'+num+'" name="imgdef'+num+'" height="40" style="float:left; border:#CCC 1px solid" /><input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open(\'Upfile.php?Dir=sanpham&amp;form=userfile'+num+'&img=imgdef'+num+'\',\'_upLoad\' ,\'height=220,width=450,resizable=no,scrollbars=yes\')") />&nbsp; <a href="javascript:;" onclick="removeElement(\''+divIdName+'\');">Xóa</a></p>';

	  ni.appendChild(newdiv);

	}
	function removeElement(divNum) {

	  var vl = document.getElementById('theValue');
	  vl.value= vl.value-1;
	  var d = document.getElementById('myDiv');

	  var olddiv = document.getElementById(divNum);

	  d.removeChild(olddiv);

	}
</script>
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">

	// O2k7 skin
tinyMCE.init({
		// General options
		mode : "txtnoidung",
		theme : "advanced",
		width : "700",
		height : "300",
		skin : "o2k7",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist,autosave,visualblocks",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,sub,sup,link,unlink,formatselect,fontselect,fontsizeselect,forecolor,backcolor",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_buttons4 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		theme_advanced_path : false, 
		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		

	});
				
/* Default skin */



</script>

<form style="padding:0; margin:0" action="index.php?tn=task_submit&id=<?php echo $row['task_id'];?>" method="post" onsubmit="return validate_form(this);" name="frmAddMessage" enctype="multipart/form-data">

   
        <div class="clear" style="height:5px"></div>
       
        <div class="clear" style="height:5px"></div>
        <div class="bodycontent">
        <table class="box-vang" border="0" cellpadding="0" cellspacing="0" width="100%">
          <tbody><tr>
            <td class="t-l" width="8px"></td>
            <td class="t-c"></td>
            <td class="t-r" width="8px"></td>
          </tr>
          <tr class="light">
            <td class="c-l"></td>
            <td class="c-c"><table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody><tr class="light">
                  <td class="title-red" colspan="2" align="left">&nbsp;Thêm mới chiến dịch Marketing</td>
                </tr>
               
                <tr>
                  <td class="title-red1" colspan="2">
Thông tin chung</td></tr>
                <tr class="light">
                  <td width="50%" style="padding:10px">
         			<table>
                    
                    <tr>
                      <td width="101" align="right">Tên chiến dịch</td><td width="318"><input type="text" style="width:250px;"/></td></tr>
                  <tr>
                       <td align="right">Mã chiến dịch</td>
                       <td><input type="text" style="width:250px;"/>
                      
								
                       </td></tr>
                   
                   <tr>
                       <td align="right">Loại chiến dịch: </td>
                       <td>
                       <select name="Lvh_Id">
                <option value="0" selected="selected">--Loại chiến dịch--</option>
                  <? 
					$sqlstring="select services_type_name,services_type_id  from tb_services_type where phanloai_id=20 order by services_type_id asc";									
					$qr12=mysql_query($sqlstring);	
					while($row=mysql_fetch_array($qr12)) 
					{				
  					?>               
                 <option  value="<?=$row['services_type_id']?>"><?=$row['services_type_name']?></option>
                  <? }?>     
                  </select>
                 
           </td></tr>
                                                     <tr>
                       <td align="right">Trạng thái: </td>
                       <td>
                       
                        <select name="Lvh_Id">
                <option value="0" selected="selected">--Trạng thái chiến dịch--</option>
                  <? 
					$sqlstring="select services_type_name,services_type_id  from tb_services_type where phanloai_id=21 order by services_type_id asc";									
					$qr12=mysql_query($sqlstring);	
					while($row=mysql_fetch_array($qr12)) 
					{				
  					?>               
                 <option  value="<?=$row['services_type_id']?>"><?=$row['services_type_name']?></option>
                  <? }?>     
                  </select></td></tr>
                        
                    </table> 
                  </td> 
                 <td width="50%" style="padding:10px">
         			<table width="510">
                                 
                   
                    <tr>
                      <td width="151" align="right">
                        Liên quan đến sản phẩm: </td><td width="347"><input type="text" style="width:300px;"/> <img width="16px" height="16px" align="absmiddle" alt="pop" src="images/btn_Lookup.png">
								</span>
								<img width="16px" height="16px" align="absmiddle" onclick="document.getElementById(&#39;dsid_nql&#39;).value=&#39;&#39;;document.getElementById(&#39;ds_nql&#39;).value=&#39;&#39;;" alt="del" src="images/Clear.gif"></td></tr>
                     
                      <tr>
                      <td align="right">Ngày bắt đầu:</td><td><input type="text" style="width:300px;"/></td></tr>
                       <tr>
                      <td align="right">Ngày kết thúc:</td><td><input type="text" style="width:300px;"/></td></tr>
                    </table> 
                  </td> 
                </tr> 
                
                 <tr>
                   <td class="title-red1" colspan="2">Kỳ vọng kết quả</td></tr>
                <tr class="light">
                  <td style="padding:10px" width="50%">
         			<table width="100%">
                    
                     <tr><td width="97" align="right">
Ngân sách cho phép: </td><td width="249"><input type="text" style="width:200px;"/> (VNĐ)</td></tr>                      
                       <tr><td align="right">Số lượng KH mục tiêu: </td><td><input type="text" style="width:200px;"/> </td></tr>
                        <tr><td align="right">Số lượng KH kỳ vọng: </td><td><input type="text" style="width:200px;"/></td></tr>
                        <tr>
                          <td align="right">Doanh thu kỳ vọng: </td><td><input type="text" style="width:200px;"/></td></tr>
                      
                   
                    </table> 
                  </td> 
                 <td style="padding:10px" width="50%">
         			<table width="100%">
                   
                    <tr><td width="148" align="right">Chi phí thực tế: </td><td width="353">
												  <input type="text" disabled="disabled" value="0" name="slkhtc">
												
                                                </td></tr>
                    <tr><td align="right">Số lượng KH tiếp cận: </td><td><input type="text" disabled="disabled" value="0" name="slkhtc">
                     </td></tr>
                    <tr>
                      <td align="right">Số cơ hội bán hàng: </td><td><input type="text" disabled="disabled" value="0" name="slkhtc"></td></tr>
                   
                    <tr><td align="right">Số lượng KH thành công: </td><td>&nbsp;<input type="text" disabled="disabled" value="0" name="slkhtc"></td></tr>
                    
                     <tr><td align="right">Doanh thu thực tế: </td><td>&nbsp;<input type="text" disabled="disabled" value="0" name="slkhtc"></td></tr>
                   
                    </table> 
                  </td> 
                </tr> 
                
                
                
                
                 <tr><td class="title-red1" colspan="2">Thông tin quản lý</td></tr>
                <tr class="light">
                  <td style="padding:10px" width="50%">
         			<table>
                    
                    <tr><td align="right">Đơn vị quản lý: </td><td><select onchange="changeNG('http://tamnguyen.gencrm.com/',this.value,1,'KH');" name="Dvi_Id" id="donvi_giao">
                    <option value="$$$">Lựa chọn</option>
                    													<option selected="selected" value="56">Phòng hệ thống</option>
						                                </select></td></tr>
                    <tr><td align="right">Người quản lý: </td><td><select onchange="changeNVG(this.value);" name="Nguoi_Quan_Ly" id="nv_giao">
			<option value="$$$">Lựa chọn</option>
											<option selected="selected" value="1">Administrator</option>
								<option value="3">Trần Đình Tứ</option>
								</select></td></tr>
                    <tr><td align="right">Người quản lý khác: </td><td><textarea cols="50" rows="3" readonly="readonly" style="width:199px;" id="ds_nql"></textarea>&nbsp;<img src="images/btn_Lookup.png" /></td></tr>                    
                    </table> 
                  </td> 
                 <td style="padding:10px" width="50%">
         			<table>
                   
                    <tr><td width="150" align="right">Người tạo: </td><td width="348"><input type="text" value="Administrator" disabled="disabled"></td></tr>
                    <tr><td align="right">Ngày tạo: </td><td><input type="text" value="11/12/2012 03:32 pm" disabled="disabled"></td></tr>
                    <tr><td align="right">Người cập nhật: </td><td><input type="text" value="Administrator" disabled="disabled"></td></tr>
                    <tr><td align="right">Ngày cập nhật: </td><td><input type="text" value="11/12/2012 03:32 pm" disabled="disabled"></td></tr>
                   
                    </table> 
                  </td> 
                </tr> 
                
                 <tr  onmouseover="mouse_den(this)" onmouseout="mouse_di(this)" bgcolor="">
                  <td colspan="2" ><strong>Mô tả công việc</strong><span class="color_khancap">*</span><br />  
                  
					<textarea name="brief" id="txtnoidung" rows="15" cols="80" style="width: 80%"></textarea>  
                     
                </tr>
                <tr  onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td >File đính kèm nếu có<br>
                    (*.gif, *.jpg, *.png, .doc, .pdf &lt; &nbsp;5000Kb)
							<div style="float:left; width:100%; margin-top:5px;">
								<input type="hidden" id="userfile1" name="sanpham_hinhanh1"  value="<?php  echo $arr_hinhanh[0]?>"/>
								<?php if($arr_hinhanh[0]==""){$sanpham_hinhanh="upload/hinhanh/photo.jpg";}else $sanpham_hinhanh = $arr_hinhanh[0];?>
								<img src="<?php  echo $sanpham_hinhanh?>" width="50" id="imgdef1" name="imgdef1" height="40" style="float:left; border:#CCC 1px solid" />
								
								<input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open('Upfile.php?Dir=sanpham&amp;form=userfile1&img=imgdef1','_upLoad' ,'height=220,width=450,resizable=no,scrollbars=yes')") />
								
								<input type="hidden" value="<?php echo $soanh;?>" name="hdnsoanh" id="theValue" />
								<a href="javascript:;" onclick="addElement();">Thêm file đính kèm</a>
							</div>
							<?php
								for($i=2; $i<=$soanh;$i++){
								$hinhanh = $arr_hinhanh[$i-1];
							?>
								<div id="my<?php echo $i;?>Div" style="float:left; width:100%; margin-top:5px;">
									<input type="hidden" id="userfile<?php echo $i;?>" name="sanpham_hinhanh<?php echo $i;?>"  value="<?php  echo $hinhanh?>"/>
									<img src="<?php echo $hinhanh?>" width="50" id="imgdef<?php echo $i;?>" name="imgdef<?php echo $i;?>" height="40" style="float:left; border:#CCC 1px solid" />
								  
								   <input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open('Upfile.php?Dir=sanpham&amp;form=userfile<?php echo $i;?>&img=imgdef<?php echo $i;?>','_upLoad' ,'height=220,width=450,resizable=no,scrollbars=yes')") />
								 
								   <a href="javascript:;" onclick="removeElement('my<?php echo $i;?>Div');">Delete</a>
								</div>
							<?php
								}
							?>
						   </td>
                </tr>
                
                
                <tr><td height="10px"></td></tr>
                <tr><td colspan="2"><input class="buttonnew" name="submit" id="submit" value="Lưu lại" type="submit">&nbsp;<input class="buttonnew" name="submit" id="submit" value="Hủy bỏ" type="submit"></td></tr>
                
                
              </tbody> </table></td>
            <td class="c-r"></td>
          </tr>
          <tr>
            <td class="b-l"></td>
            <td class="b-c"></td>
            <td class="b-r"></td>
          </tr>
        </tbody></table>
        
      </form>